﻿using System;

    class Pillars
    {
        static void Main()
        {
            int[] position=new int[8];
            int fullsum=0;
            int transferer=0;
            int[] leftsum = new int[8];
            int checker = 0;
            int lastchecker = 0;
            int binarycounter=0;
            int colcounter = 0;
            int[,] table=new int[8,8];
            for (int counter = 0; counter < 8; counter++)
            {                
                uint number=uint.Parse(Console.ReadLine());                   
                while((number/10!=0)||(number%10!=0))
                {
                    if ((number % 2) != 0) 
                    {
                        binarycounter = 1;
                    }
                    number /=2;
                    table[counter,colcounter]=binarycounter;
                    colcounter += 1;
                    binarycounter = 0;
                }
                colcounter = 0;
            }
        for(int counter=0;counter<8;counter++)
        {
            for(colcounter=0;colcounter<8;colcounter++)
            {
                if (table[counter, colcounter] == 1)
                {
                    position[colcounter] += 1;
                    fullsum++;
                }
               
            }
        }
        checker = 0;
        for (int counter = 0; counter < 8; counter++)
        {
            for (int leftcounter = 0; leftcounter < 8; leftcounter++)
            {
                checker += position[leftcounter];
                if ((lastchecker==fullsum/2)&&(fullsum%2==0))
                {
                    goto end;
                }
                else if(checker > fullsum/2)
                {
                    checker = lastchecker;
                    transferer = leftcounter;
                    goto righttester;
                }
                lastchecker = checker;
            }
        end:
            {
                Console.WriteLine("No");
                break;
            }
        righttester:
            checker = 0;
            for (int rightcounter = 8 - transferer; rightcounter >= 0; rightcounter--)
            {
                checker += position[rightcounter];
                if (checker >= lastchecker)
                {
                    checker = lastchecker;
                    Console.WriteLine( -(rightcounter-7));
                    Console.WriteLine(checker);
                    goto finishline;
                }
            }
        }
            finishline:
            {
            }
    }
}

